package com.team.mr.mrboot.controller;

import com.team.mr.mrboot.entity.Pic;
import com.team.mr.mrboot.result.ResponseCode;
import com.team.mr.mrboot.result.ResponseData;
import com.team.mr.mrboot.service.PicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Pic)表控制层
 *
 * @author makejava
 * @since 2021-05-24 17:17:47
 */
@Api(value = "picApi")
@RestController
@RequestMapping("pic")
public class PicController {
    /**
     * 服务对象
     */
    @Resource
    private PicService picService;

//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @ApiOperation(value = "selectOne",notes = "根据id获取图片信息")
//    @ApiImplicitParam(name = "id",value = "图片的id",paramType = "Integer")
//    @GetMapping("selectOne")
//    public Pic selectOne(Integer id) {
//        return this.picService.queryById(id);
//    }




    @ApiOperation(value = "queryByType",notes = "通过图片的类型获取轮播图或者导航图列表")
    @ApiImplicitParam(name = "type",value = "图片类型")
    @GetMapping("queryByType/{type}")
    public ResponseData queryByType(@PathVariable  String type){
        System.out.println("冲突！1313");
        List<Pic> pics=picService.queryByType(type);
        return new ResponseData(ResponseCode.SUCCESS,pics);
    }


}
